{include file='admin/header.html'}

<!-- 数据表格 -->
<table id="dataTable" lay-filter="dataTable"></table>

<!-- 头工具栏 -->
<script type="text/html" id="toolbar">
    <div class="layui-btn-group">
        <button class="layui-btn layui-btn-sm layui-icon layui-icon-delete" title="{$tran.delall}" lay-event="delAll"></button>
        <button class="layui-btn layui-btn-sm layui-icon layui-icon-addition" title="{$tran.add}" lay-event="add"></button>
        <button class="layui-btn layui-btn-sm layui-icon layui-icon-refresh" title="{$tran.refresh}" lay-event="refresh"></button>
    </div>
</script>

<!-- dataTable render -->
<script>
    var render = {
        elem: '#dataTable',
        toolbar: '#toolbar',
        defaultToolbar: ['filter', 'exports', 'print'],
        cellMinWidth: 80,
        height: 'full',
        where: { search: '' }, //搜索
        title: '{$tran.role_list}', //数据表格标题
        page: false, //开启分页
        cols: [[
            { type: 'checkbox', fixed: 'left' },
            { field: 'id', title: 'ID', width: 80 },
            { field: 'name', title: '{$tran.role_name}' },
            { field: 'sort', title: '{$tran.sort}', edit: 'text' },
            {
                field: 'status', title: '{$tran.status}', width: 90, templet: function (d) {
                    return '<input type="checkbox" name="status" lay-filter="status" value="' + d.id + '" lay-skin="switch" lay-text="ON|OFF"' + (d.status == 0 ? ' checked' : '') + (d.id==1 ? ' disabled' : '') + '>';
                }
            },
            { field: 'time', title: '{$tran.time}' },
            {
                title: '{$tran.option}', align: 'center', width: 125, templet: function (d) {
                    return '<button class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" title="{$tran.edit}" lay-event="edit"></button>' +
                        '<button class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete '+ (d.id==1 || d.id==2 ? ' layui-btn-disabled' : '') +'" title="{$tran.delete}"'+ (d.id==1 || d.id==2 ? ' disabled' : ' lay-event="del"') +'></button>';
                }
            }
        ]]
    }
</script>

{include file='admin/inc/dataTable.html'}

{include file='admin/footer.html'}